<RESOURCE_PROFILE>
    <HEADER>
        <RESOURCE_IDENTIFIER value="ce4fd867-e1f3-4cdb-b3a6-be28d27671fa_VHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZXMvVHJhbnNmb3JtYXRpb25SdWxlRFNSZXNvdXJjZVR5cGU="/>
        <RESOURCE_TYPE value="TransformationRuleDSResourceType"/>
        <RESOURCE_KIND value="TransformationRuleDSResources"/>
        <RESOURCE_URI value=""/>
        <DATE_OF_CREATION value="2021-03-16T12:29:06+00:00"/>
    </HEADER>
    <BODY>
        <CONFIGURATION>
            <IMPORTED/>
            <SCRIPT>
                <TITLE>DatacitePub JSON</TITLE>
                <CODE>
                <![CDATA[
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:oaf="http://namespace.openaire.eu/oaf"
    xmlns:dr="http://www.driver-repository.eu/namespace/dr"
    xmlns:TransformationFunction="eu.dnetlib.data.collective.transformation.core.xsl.ext.TransformationFunctionProxy"
    extension-element-prefixes="TransformationFunction"
    exclude-result-prefixes="TransformationFunction">
    <xsl:param name="varOfficialName"/>
    <xsl:param name="varDsType"/>
    <xsl:param name="varDataSourceId"/>
    <xsl:param name="varFP7" select="'corda_______::'"/>
    <xsl:param name="varH2020" select="'corda__h2020::'"/>
    <xsl:param name="varHostedByOfficialName" select="'Unknown Repository'"/>
    <xsl:param name="varHostedByDataSourceId"
        select="'openaire____::1256f046-bf1f-4afc-8b47-d0b147148b18'"/>

    <xsl:param name="index" select="0"/>
    <xsl:variable name="tf" select="TransformationFunction:getInstance()"/>

    <xsl:variable name="validationDate">
        <xsl:value-of select="//*[local-name() = 'dateOfCollection']"/>
    </xsl:variable>
    <xsl:variable name="identifier" select="//attributes/doi"/>
    <xsl:variable name="creators" select="//attributes/creators"/>
    <xsl:variable name="titles" select="//attributes/titles"/>
    <xsl:variable name="publisher" select="//attributes/publisher"/>
    <xsl:variable name="publicationYear" select="//attributes/publicationYear"/>
    <xsl:variable name="subjects" select="//attributes/subjects"/>
    <xsl:variable name="contributors" select="//attributes/contributors"/>
    <xsl:variable name="dates" select="//attributes/dates"/>
    <xsl:variable name="language" select="//attributes/language"/>
    <xsl:variable name="types" select="//attributes/types"/>
    <xsl:variable name="alternateIdentifiers" select="//attributes/alternateIdentifiers"/>
    <xsl:variable name="relatedIdentifiers" select="//attributes/relatedIdentifiers"/>
    <xsl:variable name="rights" select="//attributes/rightsList"/>
    <xsl:variable name="descriptions" select="//attributes/descriptions"/>



    <xsl:template match="/">
        <xsl:variable name="datasourcePrefix" select="normalize-space(//oaf:datasourceprefix)"/>
        <xsl:call-template name="validRecord"/>
    </xsl:template>

    <xsl:template name="terminate">
        <xsl:message terminate="yes"> record is not compliant, transformation is interrupted.
        </xsl:message>
    </xsl:template>

    <xsl:template name="creator">
        <xsl:param name="author"/>
        <creator>
            <xsl:if test="$author/name">
                <creatorName>
                    <xsl:value-of select="$author/name"/>
                </creatorName>
            </xsl:if>
            <xsl:if test="$author/affiliation">
                <affiliation>
                    <xsl:value-of select="$author/affiliation"/>
                </affiliation>
            </xsl:if>
            <xsl:for-each select="$author/nameIdentifiers">
                <nameIdentifier>
                    <xsl:attribute name="nameIdentifierScheme">
                        <xsl:value-of select="./nameIdentifierScheme"/>
                    </xsl:attribute>
                    <xsl:if test="./schemeURI">
                        <xsl:attribute name="schemeURI">
                            <xsl:value-of select="./schemeURI"/>
                        </xsl:attribute>
                    </xsl:if>
                    <xsl:value-of select="./nameIdentifier"/>
                </nameIdentifier>
            </xsl:for-each>
        </creator>

    </xsl:template>

    <xsl:template name="validRecord">
        <record xmlns="http://datacite.org/schema/kernel-4">
            <xsl:copy-of select="//*[local-name() = 'header']"/>

            <metadata>
                <resource>
                    <xsl:choose>
                        <xsl:when
                            test="not($identifier) or count($creators) = 0 or count($titles) = 0 or not($publisher) or not($publicationYear) or count($dates) = 0">
                            <xsl:call-template name="terminate"/>
                        </xsl:when>
                        <xsl:otherwise>

                            <identifier identifierType="DOI">
                                <xsl:value-of select="$identifier"/>
                            </identifier>

                            <creators>
                                <xsl:for-each select="$creators">
                                    <xsl:call-template name="creator">
                                        <xsl:with-param name="author" select="."/>
                                    </xsl:call-template>
                                </xsl:for-each>
                            </creators>

                            <titles>
                                <xsl:for-each select="$titles">
                                    <title>
                                        <xsl:if test="./lang">
                                            <xsl:attribute name="xml:lang" select="./lang"/>
                                        </xsl:if>
                                        <xsl:value-of select="."/>

                                    </title>
                                </xsl:for-each>
                            </titles>

                            <publisher>
                                <xsl:value-of select="$publisher"/>
                            </publisher>

                            <publicationYear>
                                <xsl:value-of select="$publicationYear"/>
                            </publicationYear>

                            <xsl:if test="count($subjects) > 0">
                                <subjects>
                                    <xsl:for-each select="$subjects">
                                        <subject>
                                            <xsl:if test="./subjectScheme">
                                                <xsl:attribute name="subjectScheme">
                                                  <xsl:value-of select="./subjectScheme"/>
                                                </xsl:attribute>
                                            </xsl:if>
                                            <xsl:if test="./schemeURI">
                                                <xsl:attribute name="schemeURI">
                                                  <xsl:value-of select="./schemeURI"/>
                                                </xsl:attribute>
                                            </xsl:if>
                                            <xsl:value-of select="./subject"/>
                                        </subject>
                                    </xsl:for-each>

                                </subjects>
                            </xsl:if>

                            <xsl:if test="count($contributors) > 0">
                                <contributors>
                                    <xsl:for-each select="$contributors">
                                        <contributor>
                                            <xsl:if test="./contributorType">
                                                <xsl:attribute name="contributorType">
                                                  <xsl:value-of select="./contributorType"/>
                                                </xsl:attribute>
                                            </xsl:if>
                                            <contributorName>
                                                <xsl:value-of select="./name"/>
                                            </contributorName>
                                        </contributor>
                                    </xsl:for-each>
                                </contributors>
                            </xsl:if>

                            <dates>
                                <xsl:for-each select="$dates">
                                    <date>
                                        <xsl:attribute name="dateType" select="./dateType"/>
                                        <xsl:value-of select="./date"/>
                                    </date>
                                </xsl:for-each>
                            </dates>

                            <xsl:if test="$language">
                                <language>
                                    <xsl:value-of select="$language"/>
                                </language>
                            </xsl:if>

                            <xsl:if test="$alternateIdentifiers">
                                <alternateIdentifiers>
                                    <xsl:for-each select="$alternateIdentifiers">
                                        <alternateIdentifier>
                                            <xsl:attribute name="alternateIdentifierType">
                                                <xsl:value-of select="./identifierType"/>
                                            </xsl:attribute>
                                            <xsl:value-of select="./identifier"/>
                                        </alternateIdentifier>
                                    </xsl:for-each>
                                </alternateIdentifiers>
                            </xsl:if>

                            <xsl:if test="$relatedIdentifiers or //relatedPubs/doi">
                                <relatedIdentifiers>
                                    <xsl:for-each select="$relatedIdentifiers">
                                        <relatedIdentifier>
                                            <xsl:attribute name="relatedIdentifierType">
                                                <xsl:value-of select="./relatedIdentifierType"/>
                                            </xsl:attribute>
                                            <xsl:if test="./relatedMetadataScheme">
                                                <xsl:attribute name="relatedMetadataScheme">
                                                  <xsl:value-of select="./relatedMetadataScheme"/>
                                                </xsl:attribute>
                                            </xsl:if>
                                            <xsl:attribute name="relationType">
                                                <xsl:value-of select="./relationType"/>
                                            </xsl:attribute>
                                            <xsl:if test="./schemeType">
                                                <xsl:attribute name="schemeType">
                                                  <xsl:value-of select="./schemeType"/>
                                                </xsl:attribute>
                                            </xsl:if>
                                            <xsl:if test="./schemeURI">
                                                <xsl:attribute name="schemeURI">
                                                  <xsl:value-of select="./schemeURI"/>
                                                </xsl:attribute>
                                            </xsl:if>
                                            <xsl:value-of select="./relatedIdentifier"/>
                                        </relatedIdentifier>
                                    </xsl:for-each>
                                </relatedIdentifiers>
                            </xsl:if>

                            <xsl:if test="$rights">
                                <rightsList>
                                    <xsl:for-each select="$rights">
                                        <rights>
                                            <xsl:if test="./rightsUri">
                                                <xsl:attribute name="rightsURI">
                                                  <xsl:value-of select="./rightsUri"/>
                                                </xsl:attribute>
                                            </xsl:if>
                                            <xsl:if test="./rights">
                                                <xsl:value-of select="./rights"/>
                                            </xsl:if>
                                        </rights>
                                    </xsl:for-each>
                                </rightsList>
                            </xsl:if>

                            <xsl:if test="$descriptions">
                                <descriptions>
                                    <xsl:for-each select="$descriptions">
                                        <description>
                                            <xsl:if test="./descriptionType">
                                                <xsl:attribute name="descriptionType">
                                                  <xsl:value-of select="./descriptionType"/>
                                                </xsl:attribute>
                                            </xsl:if>
                                            <xsl:if test="./lang">
                                                <xsl:attribute name="xml:lang">
                                                  <xsl:value-of select="./lang"/>
                                                </xsl:attribute>
                                            </xsl:if>
                                            <xsl:if test="./description">
                                                <xsl:value-of select="./description"/>
                                            </xsl:if>
                                        </description>
                                    </xsl:for-each>
                                </descriptions>
                            </xsl:if>

                            <xsl:for-each select="$dates">
                                <xsl:if test="./dateType = 'Available'">
                                    <xsl:variable name="varEmbargoEndDate"
                                        select="TransformationFunction:convertString($tf, normalize-space(./date), 'DateISO8601')"/>
                                    <xsl:if test="string-length($varEmbargoEndDate) > 0">
                                        <oaf:embargoenddate>
                                            <xsl:value-of select="$varEmbargoEndDate"/>
                                        </oaf:embargoenddate>
                                    </xsl:if>
                                </xsl:if>
                            </xsl:for-each>

                            <dr:CobjCategory>
                                <xsl:choose>
                                    <xsl:when test="$types">
                                        <xsl:choose>
                                            <xsl:when
                                                test="$types/schemaOrg = 'ScholarlyArticle' or $types/schemaOrg = 'Book' or $types/schemaOrg = 'Thesis' or $types/schemaOrg = 'Chapter' or $types/schemaOrg = 'PublicationIssue' or $types/schemaOrg = 'PublicationVolume'">
                                                <xsl:attribute name="type">
                                                  <xsl:value-of select="string('publication')"/>
                                                </xsl:attribute>
                                                <xsl:choose>
                                                  <xsl:when test="$types/bibtex = 'techreport'">
                                                  <xsl:value-of select="string('0017')"/>
                                                  </xsl:when>
                                                  <xsl:when
                                                  test="$types/schemaOrg = 'ScholarlyArticle'">
                                                  <xsl:value-of select="string('0001')"/>
                                                  </xsl:when>
                                                  <xsl:when test="$types/schemaOrg = 'Book'">
                                                  <xsl:value-of select="string('0002')"/>
                                                  </xsl:when>
                                                  <xsl:when test="$types/schemaOrg = 'Thesis'">
                                                  <xsl:value-of select="string('0041')"/>
                                                  </xsl:when>
                                                  <xsl:when test="$types/schemaOrg = 'Chapter'">
                                                  <xsl:value-of select="string('0013')"/>
                                                  </xsl:when>
                                                  <xsl:otherwise>
                                                  <xsl:value-of select="string('0038')"/>
                                                  </xsl:otherwise>
                                                </xsl:choose>
                                            </xsl:when>
                                            <xsl:when
                                                test="$types/schemaOrg = 'ImageObject' or $types/schemaOrg = 'MediaObject' or $types/schemaOrg = 'AudioObject' or $types/resourceTypeGeneral = 'Film' or $types/schemaOrg = 'Dataset'">
                                                <xsl:attribute name="type">
                                                  <xsl:value-of select="string('dataset')"/>
                                                </xsl:attribute>
                                                <xsl:choose>
                                                  <xsl:when test="$types/schemaOrg = 'ImageObject'">
                                                  <xsl:value-of select="string('0025')"/>
                                                  </xsl:when>
                                                  <xsl:when test="$types/schemaOrg = 'MediaObject'">
                                                  <xsl:value-of select="string('0033')"/>
                                                  </xsl:when>
                                                  <xsl:when test="$types/schemaOrg = 'AudioObject'">
                                                  <xsl:value-of select="string('0030')"/>
                                                  </xsl:when>
                                                  <xsl:when
                                                  test="$types/resourceTypeGeneral = 'Film'">
                                                  <xsl:value-of select="string('0024')"/>
                                                  </xsl:when>
                                                  <xsl:when test="$types/schemaOrg = 'Dataset'">
                                                  <xsl:value-of select="string('0021')"/>
                                                  </xsl:when>
                                                </xsl:choose>
                                            </xsl:when>
                                            <xsl:when test="$types/schemaOrg = 'SoftwareSourceCode'">
                                                <xsl:attribute name="type">
                                                  <xsl:value-of select="software"/>
                                                </xsl:attribute>
                                                <xsl:value-of select="string('0029')"/>
                                            </xsl:when>
                                            <xsl:when
                                                test="$types/schemaOrg = 'Event' or $types/resourceTypeGeneral = 'Model' or $types/schemaOrg = 'Collection'">
                                                <xsl:attribute name="type">
                                                  <xsl:value-of select="other"/>
                                                </xsl:attribute>
                                                <xsl:choose>
                                                  <xsl:when test="$types/schemaOrg = 'Event'">
                                                  <xsl:value-of select="string('0023')"/>
                                                  </xsl:when>
                                                  <xsl:when
                                                  test="$types/resourceTypeGeneral = 'Model'">
                                                  <xsl:value-of select="string('0027')"/>
                                                  </xsl:when>
                                                  <xsl:when test="$types/schemaOrg = 'Collection'">
                                                  <xsl:value-of select="string('0022')"/>
                                                  </xsl:when>
                                                </xsl:choose>
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <xsl:attribute name="type">
                                                  <xsl:value-of select="'other'"/>
                                                </xsl:attribute>
                                                <xsl:value-of select="string('0020')"/>
                                            </xsl:otherwise>
                                        </xsl:choose>
                                    </xsl:when>
                                    <xsl:otherwise>
                                        <xsl:attribute name="type">
                                            <xsl:value-of select="string('publication')"/>
                                        </xsl:attribute>
                                        <xsl:value-of select="string('0038')"/>
                                    </xsl:otherwise>
                                </xsl:choose>
                            </dr:CobjCategory>

                            <xsl:variable name="varRefereed"
                                select="
                                    for $i in $types/*[local-name() = ('resourceTypeGeneral', 'schemaOrg', 'citeproc', 'bibtex', 'ris')]
                                    return
                                        TransformationFunction:convertString($tf, normalize-space($i), 'ReviewLevels')"/>
                            <xsl:choose>
                                <xsl:when test="count($varRefereed[. = '0001']) > 0">
                                    <oaf:refereed>
                                        <xsl:value-of select="'0001'"/>
                                    </oaf:refereed>
                                </xsl:when>
                                <xsl:when test="count($varRefereed[. = '0002']) > 0">
                                    <oaf:refereed>
                                        <xsl:value-of select="'0002'"/>
                                    </oaf:refereed>
                                </xsl:when>
                            </xsl:choose>


                            <oaf:dateAccepted>
                                <xsl:value-of
                                    select="TransformationFunction:convertString($tf, normalize-space($publicationYear), 'DateISO8601')"
                                />
                            </oaf:dateAccepted>



                            <!-- avoiding to check access rights 'synonyms' which are listed in dnet:access_modes  -->
                       <!--     <xsl:choose>
                                <xsl:when test="//awards/awardUri">
                                    <oaf:accessrights>OPEN</oaf:accessrights>
                                </xsl:when>
                                <xsl:otherwise> -->
                                    <oaf:accessrights>
                                        <xsl:choose>
                                            <xsl:when
                                                test="//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('OPEN', 'OPEN SOURCE')]">
                                                <xsl:value-of
                                                  select="TransformationFunction:convertString($tf, subsequence(//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('OPEN', 'OPEN SOURCE')], 1, 1), 'AccessRights')"
                                                />
                                            </xsl:when>
                                            <xsl:when
                                                test="//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('EMBARGO', '6MONTHS', '12MONTHS')]">
                                                <xsl:value-of
                                                  select="TransformationFunction:convertString($tf, subsequence(//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('EMBARGO', '6MONTHS', '12MONTHS')], 1, 1), 'AccessRights')"
                                                />
                                            </xsl:when>
                                            <xsl:when
                                                test="//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('RESTRICTED')]">
                                                <xsl:value-of
                                                  select="TransformationFunction:convertString($tf, subsequence(//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('RESTRICTED')], 1, 1), 'AccessRights')"
                                                />
                                            </xsl:when>
                                            <xsl:when
                                                test="//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('CLOSED', 'OTHER')]">
                                                <xsl:value-of
                                                  select="TransformationFunction:convertString($tf, subsequence(//rights/(., ../rightsUri)[TransformationFunction:convertString($tf, ., 'AccessRights') = ('CLOSED', 'OTHER')], 1, 1), 'AccessRights')"
                                                />
                                            </xsl:when>
                                            <xsl:otherwise>
                                                <xsl:value-of
                                                  select="TransformationFunction:convertString($tf, subsequence(//rights/(., ../rightsUri), 1, 1), 'AccessRights')"
                                                />
                                            </xsl:otherwise>
                                        </xsl:choose>

                                    </oaf:accessrights>
                             <!--   </xsl:otherwise>
                            </xsl:choose>-->

                            <xsl:for-each
                                select="//rightsUri[starts-with(normalize-space(.), 'http') and matches(., '.*(/licenses|/publicdomain|unlicense.org/|/legal-and-data-protection-notices|/download/license|/open-government-licence).*')]">
                                <oaf:license>
                                    <xsl:copy-of select="normalize-space(.)"/>
                                </oaf:license>
                            </xsl:for-each>

                            <oaf:language>
                                <xsl:value-of
                                    select="TransformationFunction:convert($tf, $language, 'Languages')"
                                />
                            </oaf:language>


                            <xsl:variable name="awards" select="//metadata/awards/award"/>
                            <xsl:variable name="varAKA" select="'aka_________::'"/>
                            <xsl:variable name="varARC" select="'arc_________::'"/>
                            <xsl:variable name="varCONICYT" select="'conicytf____::'"/>
                            <xsl:variable name="varDFG" select="'dfgf________::'"/>
                            <xsl:variable name="varFCT" select="'fct_________::'"/>
                            <xsl:variable name="varFWF" select="'fwf_________::'"/>
                            <xsl:variable name="varHRZZ" select="'irb_hr______::'"/>
                            <xsl:variable name="varMESTD" select="'mestd_______::'"/>
                            <xsl:variable name="varMIUR" select="'miur________::'"/>
                            <xsl:variable name="varMZOS" select="'irb_hr______::'"/>
                            <xsl:variable name="varNHMRC" select="'nhmrc_______::'"/>
                            <xsl:variable name="varNIH" select="'nih_________::'"/>
                            <xsl:variable name="varNSF" select="'nsf_________::'"/>
                            <xsl:variable name="varNWO" select="'nwo_________::'"/>
                            <xsl:variable name="varRCUK" select="'rcuk________::'"/>
                            <xsl:variable name="varUKRI" select="'ukri________::'"/>
                            <xsl:variable name="varSFI" select="'sfi_________::'"/>
                            <xsl:variable name="varSGOV" select="'sgov________::'"/>
                            <xsl:variable name="varSNSF" select="'snsf________::'"/>
                            <xsl:variable name="varTARA" select="'taraexp_____::'"/>
                            <xsl:variable name="varTUBITAK" select="'tubitakf____::'"/>
                            <xsl:variable name="varWT" select="'wt__________::'"/>
                            <xsl:variable name="varANR" select="'anr_________::'"/>
                            <xsl:for-each select="//attributes/fundingReferences">
                                <xsl:choose>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/501100000780') or starts-with(normalize-space(./awardUri), 'info:eu-repo/grantAgreement/EC/H2020')">
                                        <!--H2020-->


                                        <oaf:projectid>
                                            <xsl:value-of select="concat($varH2020, ./awardNumber)"
                                            />
                                        </oaf:projectid>

                                    </xsl:when>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/100011102') or starts-with(normalize-space(./awardUri), 'info:eu-repo/grantAgreement/EC/FP7')">
                                        <!-- FP7 -->

                                        <oaf:projectid>
                                            <xsl:value-of select="concat($varFP7, ./awardNumber)"/>
                                        </oaf:projectid>


                                    </xsl:when>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/501100001665') or contains(./funderName, 'Agence Nationale de la Recherche') or contains(./funderName, 'ANR')">
                                        <!-- ANR -->
                                        <oaf:projectId>
                                            <xsl:value-of select="concat($varANR, ./awardNumber)"/>
                                        </oaf:projectId>
                                    </xsl:when>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/501100002341') or contains(./funderName, 'Suomen Akatemia') or contains(./funderName, 'Academy of Finland')">
                                        <!-- AKA -->
                                        <oaf:projectId>
                                            <xsl:value-of select="concat($varAKA, ./awardNumber)"/>
                                        </oaf:projectId>
                                    </xsl:when>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/501100000923') or contains(./funderName, 'Australian Research Council')">
                                        <!-- ARC -->
                                        <oaf:projectId>
                                            <xsl:value-of select="concat($varARC, ./awardNumber)"/>
                                        </oaf:projectId>
                                    </xsl:when>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/501100002848') or contains(./funderName, 'Comisión Nacional de Investigación Científica y Tecnológica') or contains(./funderName, 'CONICYT')">
                                        <!-- CONICYT -->
                                        <oaf:projectId>
                                            <xsl:value-of
                                                select="concat($varCONICYT, ./awardNumber)"/>
                                        </oaf:projectId>
                                    </xsl:when>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/501100001659') or contains(./funderName, 'Deutsche Forschungsgemeinschaft') or contains(./funderName, 'DFGH')">
                                        <!-- DFG -->
                                        <oaf:projectId>
                                            <xsl:value-of select="concat($varDFG, ./awardNumber)"/>
                                        </oaf:projectId>
                                    </xsl:when>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/501100000690') or contains(./funderName, 'Research Councils UK') or contains(./funderName, 'RCUK')">
                                        <!-- RCUK -->
                                        <oaf:projectId>
                                            <xsl:value-of select="concat($varUKRI, ./awardNumber)"/>
                                        </oaf:projectId>
                                    </xsl:when>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/100014013') or contains(./funderName, 'UK Research and Innovation') or contains(./funderName, 'UKRI')">
                                        <!-- RCUK -->
                                        <oaf:projectId>
                                            <xsl:value-of select="concat($varUKRI, ./awardNumber)"/>
                                        </oaf:projectId>
                                    </xsl:when>
                                    <xsl:when
                                        test="contains(./funderName, 'Ministerio de Economía y Competitividad') or contains(./funderName, 'Gobierno de Espana') or contains(./funderName, 'Ministry of Economy and Competitiveness')">
                                        <!-- SGOV -->
                                        <oaf:projectId>
                                            <xsl:value-of select="concat($varSGOV, ./awardNumber)"/>
                                        </oaf:projectId>
                                    </xsl:when>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/501100001711') or contains(./funderName, 'Swiss National Science Foundation') or contains(./funderName, 'Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung')">
                                        <!-- SNSF -->
                                        <oaf:projectId>
                                            <xsl:value-of select="concat($varSNSF, ./awardNumber)"/>
                                        </oaf:projectId>
                                    </xsl:when>
                                    <xsl:when
                                        test="ends-with(./funderIdentifier, '10.13039/501100004410') or contains(./funderName, 'Turkish National Science and Research Council') or (contains(./funderName, 'Türkiye Bilimsel ve Teknolojik Ara') and contains(./funderName, 'rma Kurumu'))">
                                        <!-- TUBITAK -->
                                        <oaf:projectId>
                                            <xsl:value-of
                                                select="concat($varTUBITAK, ./awardNumber)"/>
                                        </oaf:projectId>
                                    </xsl:when>
                                </xsl:choose>
                            </xsl:for-each>


                            <xsl:for-each select="distinct-values(//awards/awardUri)">
                                <xsl:if
                                    test="starts-with(normalize-space(.), 'info:eu-repo/grantAgreement/EC/H2020')">
                                    <xsl:variable name="projectId"
                                        select="substring-after(., 'info:eu-repo/grantAgreement/EC/H2020/')"/>
                                    <oaf:projectid>
                                        <xsl:attribute name="validationDate">
                                            <xsl:value-of select="$validationDate"/>
                                        </xsl:attribute>
                                        <xsl:value-of select="concat($varH2020, $projectId)"/>
                                    </oaf:projectid>
                                </xsl:if>

                                <xsl:if
                                    test="matches(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', 'i')">
                                    <oaf:projectid>
                                        <xsl:value-of
                                            select="concat($varFP7, replace(normalize-space(.), '(info:eu-repo/grantagreement/ec/fp7/)(\d\d\d\d\d\d)(.*)', '$2', 'i'))"
                                        />
                                    </oaf:projectid>
                                </xsl:if>
                            </xsl:for-each>


                            <oaf:hostedBy>
                                <xsl:attribute name="name">
                                    <xsl:value-of select="$varHostedByOfficialName"/>
                                </xsl:attribute>
                                <xsl:attribute name="id">
                                    <xsl:value-of select="$varHostedByDataSourceId"/>
                                </xsl:attribute>
                            </oaf:hostedBy>
                            <oaf:collectedFrom>
                                <xsl:attribute name="name">
                                    <xsl:value-of select="$varOfficialName"/>
                                </xsl:attribute>
                                <xsl:attribute name="id">
                                    <xsl:value-of select="$varDataSourceId"/>
                                </xsl:attribute>
                            </oaf:collectedFrom>

                        </xsl:otherwise>
                    </xsl:choose>
                </resource>
            </metadata>
            <xsl:copy-of select="//*[local-name() = 'about']"/>
        </record>
    </xsl:template>



</xsl:stylesheet>
]]>

</CODE>
            </SCRIPT>
        </CONFIGURATION>
        <STATUS/>
        <SECURITY_PARAMETERS/>
    </BODY>
</RESOURCE_PROFILE>